package four.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class FactoryBean {
    private String name;
    public int age;

    @JsonCreator
    public static FactoryBean createP(@JsonProperty("name") String name,
                                      @JsonProperty("age") int age) {
        FactoryBean p = new FactoryBean(name, age);
        return p;
    }

    public FactoryBean(String name, int age) {
        this.name = name;
        this.age = age;
    }


    @Override
    public String toString() {
        return "P{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}

